//
//  RZQCuriousConllectionCell.m
//  LastOne
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "RZQCuriousConllectionCell.h"
#import <UIImageView+WebCache.h>
#import "FitHeader.h"
@implementation RZQCuriousConllectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatAction];
    }
    return self;
}
-(void)creatAction
{
   
   
    _bigImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, 200 * FitHeight)];
    [self.contentView addSubview:_bigImage];
   
    
    
    _titleLabel = [[UILabel alloc]init];
   
    
    [self.contentView addSubview:_titleLabel];
    
    _messageLabel = [[UILabel alloc]init];
    
    [self.contentView addSubview:_messageLabel];
    
    _smallImage = [[UIImageView alloc]initWithFrame:CGRectMake(20 * FitWidth, 150 * FitHeight, 40 * FitWidth, 40 * FitHeight)];
    
    [self.contentView addSubview:_smallImage];
    
    _baseView = [[UIView alloc]initWithFrame:CGRectMake(self.contentView.frame.size.width -  100 * FitWidth, 0, 60 * FitWidth, 70 * FitHeight)];
     
    _baseView.backgroundColor = [UIColor colorWithRed:0.33 green:0.83 blue:0.58 alpha:1];
    [self.contentView addSubview:_baseView];
    
    _numberLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 40 * FitHeight, _baseView.frame.size.width, 20 * FitHeight)];
    [_baseView addSubview:_numberLabel];
    
    _joinView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 0, _baseView.frame.size.width - 10 * FitWidth, 40* FitHeight)];
    _joinView.image = [UIImage imageNamed:@"iconfont-join (1)"];
    [_baseView addSubview:_joinView];
    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
   
    
    
}
-(void)setCuriouseData:(CirleModel *)curiouseData
{
    if (_curiouseData != curiouseData) {
        _curiouseData = curiouseData;
 
    }
    [_bigImage sd_setImageWithURL:[NSURL URLWithString:_curiouseData.image] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
    [_smallImage sd_setImageWithURL:[NSURL URLWithString:[_curiouseData.category objectForKey:@"image"]] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
    if (_curiouseData.record_count <= 1000) {
        _numberLabel.text = @"NEW";
        _numberLabel.textColor = [UIColor colorWithRed:0.95 green:0.93 blue:0 alpha:1];
    }
    else
    {
        _numberLabel.text = [NSString stringWithFormat:@"%ld", _curiouseData.record_count];
 
        _numberLabel.textColor = [UIColor whiteColor];
    }
    _numberLabel.textAlignment = 1;
    _numberLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];
   
    
    
    _titleLabel.text = _curiouseData.title;
    _titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:25];
    
    
    _messageLabel.text = _curiouseData.Description;
    _messageLabel.font  = [UIFont fontWithName:@"Helvetica-Bold" size:18];
  
}
-(void)setTitlesize:(CGFloat)titlesize
{
    if (_titlesize != titlesize) {
        _titlesize = titlesize;
    }
    _titleLabel.frame = CGRectMake(20 * FitWidth, 200 * FitHeight, self.contentView.frame.size.width - 30 * FitWidth, _titlesize);
    
    _titleLabel.numberOfLines = 0;
}
-(void)setMessagesize:(CGFloat)messagesize
{
    if (_messagesize != messagesize) {
        _messagesize = messagesize;
    }
    _messageLabel.frame = CGRectMake(20 * FitWidth, 200 * FitHeight + _titlesize, self.contentView.frame.size.width - 40 * FitWidth, _messagesize);
   
    
    _messageLabel.numberOfLines = 0;

    
   
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
